#include "prec.h"
#include "app.h"
#include "infopage.h"
#include "imagefactory.h"
#include "pagehelper.h"

InfoPage::InfoPage( wxWindow* parent, wxWindowID id, const wxBitmap& bitmap, const wxPoint& pos, const wxSize& size, long style ) 
: ArtPanel( parent, id, ImageFactory::GetBitmap(wxT("info_bg.png"), wxBITMAP_TYPE_PNG), pos, size, style, 0 )
, m_sec(0)
{
	wxBoxSizer* bSizer59;
	bSizer59 = new wxBoxSizer( wxVERTICAL );

	bSizer59->Add( 0, 0, 1, wxEXPAND, 5 );

	m_stLoadingInfo = new ArtStaticText( this, wxID_ANY, _("System loading... ...5"), wxDefaultPosition, wxDefaultSize, wxNO_BORDER );
	m_stLoadingInfo->SetFont( wxFont( 13, 70, 90, 92, false, wxEmptyString ) );
	bSizer59->Add( m_stLoadingInfo, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );


	this->SetSizer( bSizer59 );
	this->Layout();

	m_timer = new wxTimer(this);

	Connect(m_timer->GetId(), wxEVT_TIMER, wxTimerEventHandler(InfoPage::OnTimer));
	m_timer->Start(1000);
}

InfoPage::~InfoPage()
{

}

void InfoPage::OnTimer( wxTimerEvent& event )
{
	++m_sec;

	if (m_sec > 5)
	{
		m_timer->Stop();
		PageHelper::ShowPage(1);
		return;
	}

	m_stLoadingInfo->SetLabel(wxString::Format(_("System loading... ...%d"), 5-m_sec));
}